<template>
  <div class="imginfo-box">
    <h2 class="title">{{list.title}}</h2>
    <p class="box">
      <span class="time">时间: {{list.add_time | timeF}}</span>
      <span class="time">次数: {{list.click}}</span>
    </p>
    <hr>
    <vue-preview :slides="imgList" @close="handleClose"></vue-preview>
    <div v-html="list.content"></div>
    <hyc :id="id"></hyc>
  </div>
</template>
<script>
import test from "../common/comment";
export default {
  data() {
    return {
      id: this.$route.params.test,
      list: {},
      slide1: [
        {
          src:
            "https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_b.jpg",
          msrc:
            "https://farm6.staticflickr.com/5591/15008867125_68a8ed88cc_m.jpg",
          alt: "picture1",
          title: "Image Caption 1",
          w: 600,
          h: 400
        },
        {
          src:
            "https://farm4.staticflickr.com/3902/14985871946_86abb8c56f_b.jpg",
          msrc:
            "https://farm4.staticflickr.com/3902/14985871946_86abb8c56f_m.jpg",
          alt: "picture2",
          title: "Image Caption 2",
          w: 1200,
          h: 900
        }
      ],
      imgList: []
    };
  },
  methods: {
    getList() {
      this.$http.get("api/getimageInfo/" + this.id).then(res => {
        this.list = res.body.message[0];
      });
    },
    handleClose() {
      console.log("close event");
    },
    getImgList() {
      this.$http.get('api/getthumimages/' + this.id).then(res=>{
        res.body.message.forEach(item=>{
          item.msrc = item.src
          item.w = 900
          item.h = 900
        })
        this.imgList = res.body.message
      })
    }
  },
  created() {
    this.getList();
    this.getImgList();
  },
  components: {
    hyc: test
  }
};
</script>
<style lang="scss" scoped>
.imginfo-box {
  padding: 0 3px;
  .title {
    font-size: 16px;
    color: #26a2ff;
    text-align: center;
  }
  .box {
    justify-content: space-between;
    display: flex;
    margin: 3px;
  }
  hr {
    margin: 5px 0;
  }
}
</style>